//package com.orange.cloud.common.core.knife4j;
//
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.*;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spi.service.contexts.SecurityContext;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//import java.util.Collections;
//
//@Configuration
//@EnableSwagger2
//@Slf4j
//public class Knife4jConfig {
//    @Bean
//    public Docket createRestApi() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo())
//                .select()
//                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//                .paths(PathSelectors.any())
//                .build()
//                 //.securitySchemes(Collections.singletonList(securityScheme()))
//                .securityContexts(Collections.singletonList(securityContext()))
//                .useDefaultResponseMessages(false);
//    }
//
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("有来科技API")
//                .contact(new Contact("youlai", "https://www.youlai.store", "youlaistore@163.com"))
//                .version("1.0.0")
//                .build();
//    }
//
//    private SecurityScheme securityScheme() {
//       /* GrantType grantType = new ResourceOwnerPasswordCredentialsGrant(AUTH_TOKEN_ENDPOINT);
//
//        return new OAuthBuilder()
//                .name("OAuth2")
//                .grantTypes(Collections.singletonList(grantType))
//                .scopes(Arrays.asList(scopes()))
//                .build();*/
//        return null;
//    }
//
//    private AuthorizationScope[] scopes() {
//        AuthorizationScope[] scopes = {};
//        return scopes;
//    }
//
//    private SecurityContext securityContext() {
//        return SecurityContext.builder()
//                .securityReferences(Collections.singletonList(new SecurityReference("OAuth2", scopes())))
//                .forPaths(PathSelectors.any())
//                .build();
//    }
//
//}
